import cv2 as cv
cap = cv.VideoCapture(2)
while(1):
    _,frame = cap.read()
    cv.imshow("test",frame)
    key = cv.waitKey(10)
    if key == ord("c"):
        cv.imwrite("test.jpg",frame)
    elif key == ord("q"):
        break